<!DOCTYPE html>111
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var mulit = function(){
            console.log('开始计算面积');
            var a = 1;
            for( var i = 0, l = arguments.length; i < l; i++ ){
                a = a* arguments[i]
            }
             console.log(a)
            return a;
           
        }

        // mulit(2,3);
        // mulit(2,3,4);

        var proxymult = (function(){
            var cache = {};
            return function(){
                var args = Array.prototype.join.call(arguments, ',');
                // console.log(args);
                // args = arg.call(arguments);   
                // console.log(args);
                console.log('cache',cache)
                console.log('args',args)
                var i = 0;
                // console.log('cache[ args ]',mulit.apply(this, arguments))
                if(args in cache){
                    console.log('cache1',cache)
                    console.log('args1',args)
                    return cache[ args ];
                }
                return cache[ args ] = mulit.apply(this, arguments);
            }
        })();

        proxymult(1,2,3,4);
    </script>
</body>
</html>